
""" design a calculator with Simple Factory pattern"""

class Operator:
    """ generic Operator class """

    def check(self, lop, rop):
        if (type(lop) == int) and (type(rop) == int):
            return True
        else:
            return False        

    def operation(self, lop=0, rop=0):
        return 0

class Adder(Operator):
    """ Adder """
    
    def operation(self, lop=0, rop=0):        
        return lop + rop

class Subber(Operator):

    def operation(self, lop=0, rop=0):
        return lop - rop


class Multer(Operator):

    def operation(self, lop=0, rop=0):
        return lop * rop

class Diver(Operator):

    def operation(self, lop=0, rop=0):
        return lop / rop

class OperatorFactory:
    """ OperatorFactory """
    @staticmethod
    def create_operator(op):
        if op == '+':
            return Adder()
        elif op == '-':
            return Subber()
        elif op == '*':
            return Multer()
        elif op == '/':
            return Diver()

if __name__ == "__main__":
    op = OperatorFactory.create_operator('+')
    print op.operation(2, 3)
